package com.soup.lab.basic.proxy;

import org.junit.jupiter.api.Test;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.reflect.Method;

public class JDKAnnoProxyTestCase {

    @Test
    public void test() throws NoSuchMethodException {
        Method method = JDKAnnoProxyTestCase.class.getMethod("rubberDuck");
        Duck annotation = method.getAnnotation(Duck.class);
        // false
        System.out.println(annotation.value() == annotation.value());
        // class com.soup.lab.basic.proxy.$Proxy9
        System.out.println(annotation.getClass());
    }

    @Duck({"bia~ bia~", "abc"})
    public void rubberDuck() {
    }

    @Retention(RetentionPolicy.RUNTIME)
    @Target(ElementType.METHOD)
    @interface Duck {
        String[] value();
    }

}
